package com.hq.controller;

import com.hq.pojo.RoleLogin;
import com.hq.service.RoleLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.Map;

@Controller
@RequestMapping("/role")
public class RoleLoginController {
    @Autowired
    private RoleLoginService service;

    @RequestMapping("/login")
    @ResponseBody
    public Map<String, String> roleLogin(HttpSession session, RoleLogin roleLogins) {
        session.setAttribute("username", roleLogins.getUsername());
        return service.roleLogin(roleLogins);
    }

    @RequestMapping("/signIn")
    @ResponseBody
    public Map<String, String> roleSignIn(RoleLogin roleLogins) {
        return service.roleSignIn(roleLogins);
    }
}
